import { http } from "@/utils/http";
import { systemUrlApi } from "@/api/utils";

export type Domain = {
  /**
   * 业务领域id
   */
  id: string;

  /**
   * 业务领域名称
   */
  name: string;

  /**
   * 业务领域编号
   */
  code: string;

  /**
   * 开始时间
   */
  startTime: Date;

  /**
   * 结束时间
   */
  endTime: Date;

  /**
   * 0正常 9-冻结
   */
  status: string;

  /**
   * 创建者
   */
  createBy: number;

  /**
   * 创建时间
   */
  createTime: Date;

  /**
   * 更新者
   */
  updateBy: number;
};

export const getUserDomains = () => {
  return http.request<Domain[]>(
    "get",
    systemUrlApi("/system/v1/domain/user-domains")
  );
};

/** 获取角色管理-权限-菜单权限 */
export const getUserDomainIds = (userId: string) => {
  return http.request<Array<string>>(
    "get",
    systemUrlApi("/system/v1/domain/user-domain-ids/" + userId)
  );
};
